//
//  RaiseRecordTableViewCell.m
//  Kjs-iOS
//
//  Created by 江伟 on 16/7/10.
//  Copyright © 2016年 jmhz. All rights reserved.
//

#import "RaiseRecordTableViewCell.h"
#import "CommonUtil.h"

@implementation RaiseRecordTableViewCell

- (void)awakeFromNib {
    // Initialization code
    self.raiseMoney.adjustsFontSizeToFitWidth = YES;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
    
    // Configure the view for the selected state
}

- (void)setRecord:(ItemInfo *)record
{
    NSLog(@"%@",record);
    self.itemNameLab.text = record.itemName;
    self.gdAnnualizedBenefitRateLab.text = [NSString stringWithFormat:@"%.2lf％",record.gdAnnualizedBenefitRate*100];
    self.interestDaysLab.text = [NSString stringWithFormat:@"%d天",record.interestDays];
    self.gdBenefitModeLab.text = [CommonUtil getGdBenefitModeStrWithMode:record.gdBenefitMode];
    NSNumberFormatter *formatter = [[NSNumberFormatter alloc] init];
    formatter.numberStyle = NSNumberFormatterDecimalStyle;
    NSString *raiseMoneyStr = [formatter stringFromNumber:[NSNumber numberWithDouble:record.raiseMoney]];
    self.raiseMoney.text = [NSString stringWithFormat:@"¥%@",raiseMoneyStr];
    self.itemStatusLab.text = [CommonUtil getItemStatusStrWithStatus:record.itemStatus];
    //时间戳转换显示
    NSDateFormatter *df = [[NSDateFormatter alloc] init];
    [df setDateFormat:@"yyyy-MM-dd"];
    [df setLocale:[[NSLocale alloc]initWithLocaleIdentifier:@"zh_CN"]];
    NSDate *itemStatusChangeTime = [NSDate dateWithTimeIntervalSince1970:(record.itemStatusChangeTime + 8 * 3600 * 1000)/1000];
    self.itemStatusChangeTime.text = [df stringFromDate:itemStatusChangeTime];
    
}
@end
